package org.yellow.backend.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.yellow.backend.pojo.department;
import org.yellow.backend.service.departmentService;

import java.util.List;

/**
 * @author: hy
 * @create: 2024-01-01
 */
@Slf4j
@RestController
@SuppressWarnings({"all"})
@RequestMapping("/dep")
public class departmentController {
    @Autowired
    private departmentService service;
    @GetMapping("/all")
    public List<department> selectAlldepartmemt(){
        log.info("查询所有部门");
        return service.selectAlldepartmemt();
    }

    @GetMapping("/{id}")
    public department selectDepById(@PathVariable("id") int id){
        log.info("查询编号为"+id+"的部门");
        return service.selectDepById(id);
    }
}
